package view;

import javax.swing.JPanel;
import javax.swing.JScrollPane;

import java.util.Observable;
import java.util.Observer;

import adamsLibrary.JComboBoxAuto;
import control.OrderControl;

import javax.swing.JTextArea;
import java.awt.BorderLayout;
import java.awt.Color;

public class ErrorPanel extends JPanel implements Observer{
	private OrderControl oc;
	private JComboBoxAuto productComboBox;
	private JPanel op;
	private JTextArea textArea;
	
	public ErrorPanel(OrderControl oc) {
	
		this.oc=oc;
		op = this;
		setLayout(new BorderLayout(0, 0));
		textArea = new JTextArea();
		textArea.setEditable(false);
		textArea.setBackground(Color.black);
		textArea.setForeground(Color.green);
		textArea.setLineWrap(true);
		JScrollPane scrollPane = new JScrollPane(textArea);
		add(scrollPane, BorderLayout.CENTER);
	}
	
	@Override
	public void update(Observable observable, Object object) {
		textArea.setText("");
		if(object != null){
			textArea.insert(object.toString(), 0);
		}
	}
		
}
